/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package genetischeralgorithmus;
import java.util.*;
import java.awt.*;
/**
 *
 * @author Dominik
 */
public class Print {


protected GenetischerAlgorithmusView view1;
    
    
public Print(GenetischerAlgorithmusView view1){
    this.view1 = view1;
    
}


public void printPath(int[] path, LinkedList<Point> places){
    for (int i=0; i<path.length-1;i++){
       

        double x1 = places.get(path[i]-1).getX();
        double y1 = places.get(path[i]-1).getY();
        double x2 = places.get(path[i+1]-1).getX();
        double y2 = places.get(path[i+1]-1).getY();

        view1.canvas1.getGraphics().drawLine((int)(x1),(int)(y1), (int)(x2), (int)(y2));


    }

    //erstes und letztes Element verbindem
    double x1 = places.get(path[0]-1).getX();
    double y1 = places.get(path[0]-1).getY();
    double x2 = places.get(path[path.length-1]-1).getX();
    double y2 = places.get(path[path.length-1]-1).getY();

    view1.canvas1.getGraphics().drawLine((int)(x1),(int)(y1), (int)(x2), (int)(y2));


}

}
